package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class FindOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        if(bookList.getUsedSize() == 0) {
            System.out.println("目前暂时没有图书，请稍后过来查看...");
            return;
        }
        System.out.println("查找图书...");
        Scanner in = new Scanner(System.in);
        String name = in.nextLine();
        Book book;
        if((book = bookList.findBookOfName(name)) == null) {
            System.out.println("未找到图书...");
        } else {
            System.out.println(book);
        }
    }
}
